package com.briup.test;

import com.briup.Dao.StuMapper;
import com.briup.uitls.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.Test;

public class Delect {
    //通过id删除一个学生信息
    @Test
    public void delectById(){
        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();

        //build.openSession(true);设置自动提交事务,默认为false
        SqlSession sqlSession = sqlSessionFactory.openSession(true);
        try{
            StuMapper mapper = sqlSession.getMapper(StuMapper.class);
            boolean b = mapper.deleteById(7);
            System.out.println(b);
        }finally{
            sqlSession.close();
        }
    }
}
